package com.lovo.csc.controller;


import com.lovo.csc.entity.Discount;
import com.lovo.csc.service.IDiscountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 每个用户等级有一个不同的折扣优惠 前端控制器
 * </p>
 *
 * @author lovo
 * @since 2022-07-07
 */
@RestController
@RequestMapping("/discount")
@Api(tags = "折扣率操作层")
public class DiscountController {
    @Autowired
    IDiscountService service;
    @ApiOperation(value = "添加会员等级")
    @PostMapping("AddGrade")
    public boolean addRecord(Discount discount){
       return service.save(discount);
    }
    @ApiOperation(value = "查看会员等级折扣率")
    @GetMapping("FindDiscount")
    public List<Discount> getDiscount(){
        return service.list();
    }


}
